/**
 * <b>项目名：</b>ht-web<br/>  
 * <b>包名：</b>com.flea.hclv.controller<br/>  
 * <b>文件名：</b>PersonInfoController.java<br/>  
 * <b>版本信息：</b>1.0<br/>  
 * <b>日期：</b>2019年8月8日 上午11:25:34<br/>  
 * <b>COPYRIGHT 2010-2012 ALL RIGHTS RESERVED 虫子科技</b>-版权所有<br/>
 */
package com.flea.hclv.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.flea.hclv.model.entity.PersonCardInfo;
import com.flea.hclv.service.PersonCardInfoService;
import com.flea.hclv.util.ServerResponse;
import com.flea.system.base.util.StringUtil;

/**
 * @description TODO
 * @createTime 2019年8月8日 上午11:25:34
 * @modifyTime 
 * @author myflea@163.com
 * @version 1.0
 */
@Controller
@RequestMapping("/flea/hclv/person/card")
public class PersonCardInfoController {
	@Autowired
	private PersonCardInfoService personCardInfoService;
    @RequestMapping("sss")
    @ResponseBody
    public ServerResponse<String> saveOrUpdate(HttpServletRequest request, HttpServletResponse response) throws Exception {
//        String userId = FleaOrgUtils.getCurUserUuid(request);
//        OrgDept currentUserDept = FleaOrgUtils.getCurrentUserDept(request);
        String model = request.getParameter("model");

        PersonCardInfo personCardInfo = JSONObject.parseObject(model,PersonCardInfo.class);
        ServerResponse<String> serverResponse = personCardInfoService.saveOrUpdate(personCardInfo);
        return serverResponse;
    }
    /**
     * 查找所有  （供管理员使用）
     * @param request request
     * @param paging 分页对象
     * @param zhName 中文名字
     * @param enName 英文名
     * @return list
     */
	/*
	 * @RequestMapping("selectAll")
	 * 
	 * @ResponseBody public ServerResponse<FleaPage<PersonInfo>>
	 * selectAll(HttpServletRequest request, FleaPage<HVisitor> paging,
	 * 
	 * @RequestParam(value = "projectCode",defaultValue = "")String projectCode,
	 * 
	 * @RequestParam(value = "name",defaultValue = "")String name,
	 * 
	 * @RequestParam(value = "personNo",defaultValue = "")String personNo ){ OrgDept
	 * currentUserDept = FleaOrgUtils.getCurrentUserDept(request); return
	 * personInfoService.selectAll(paging.getCurPage(),paging.getPageSize(),
	 * projectCode,name,personNo);
	 * 
	 * }
	 */
    @RequestMapping("findByWxNo")
    @ResponseBody
    public ServerResponse<PersonCardInfo> findByWxNo(HttpServletRequest request, String model
    		){
    	if(StringUtil.isEmpty(model)) {
    		return ServerResponse.createByErrorMessage("微信号为空");
    	}
    	return personCardInfoService.findByWxNo(model);
    	
    }
	/*
	 * @RequestMapping("deleteByIds")
	 * 
	 * @ResponseBody public ServerResponse<String> deleteByIds(HttpServletRequest
	 * request,HttpServletResponse response, @RequestParam("ids")String ids){ String
	 * userId = FleaOrgUtils.getCurUserUuid(request); List<String> idList =
	 * JSON.parseArray(ids,String.class); ServerResponse<String> serverResponse =
	 * personInfoService.deleteByIds(userId,idList); return serverResponse; }
	 */

}
